package com.fjwt.gz.service.impl;

import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fjwt.gz.db.dto.SysScheduledLogDTO;
import com.fjwt.gz.db.entity.SysScheduledLogEntity;
import com.fjwt.gz.service.mapper.SysScheduledLogMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 系统定时任务执行日志表 服务实现类
 * </p>
 *
 * @author mei
 * @since 2025-07-16
 */
@Slf4j
@Service
public class SysScheduledLogService extends ServiceImpl<SysScheduledLogMapper, SysScheduledLogEntity> {

    /**
     * 获取列表
     *
     * @param iPage
     * @param scheduledLogDTO
     * @return
     */
    public IPage<SysScheduledLogEntity> getSysScheduledLogList(IPage<SysScheduledLogEntity> iPage, SysScheduledLogDTO scheduledLogDTO) {
        LambdaQueryWrapper<SysScheduledLogEntity> eq = SysScheduledLogEntity.gw()
                .like(StrUtil.isNotBlank(scheduledLogDTO.getScheduledName()), SysScheduledLogEntity::getScheduledName, scheduledLogDTO.getScheduledName())
                .eq(StrUtil.isNotBlank(scheduledLogDTO.getMethodName()), SysScheduledLogEntity::getMethodName, scheduledLogDTO.getMethodName())
                .eq(StrUtil.isNotBlank(scheduledLogDTO.getStatus()), SysScheduledLogEntity::getStatus, scheduledLogDTO.getStatus());
        return this.page(iPage, eq);
    }
}
